package com.example.cd5160866.urlapp;

import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.Switch;

import com.example.cd5160866.urlapp.view.GroupCell;


public class Demo2Activity extends AppCompatActivity {
    GroupCell groupCell;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.demo_2);
        groupCell = (GroupCell) findViewById(R.id.gc);
        findViewById(R.id.tv_setting).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                groupCell.setText("1111\n2222222229222222222222222292222222222\n333333121213133333333333333333333333432222");
                //                groupCell.setDrawableStart(getResources().getDrawable(R.mipmap.ic_launcher));
            }
        });
        findViewById(R.id.gc).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                groupCell.setDividerDrawable(getResources().getDrawable(R.drawable.divider_line_left_insert_10));
            }
        });
        findViewById(R.id.tv_test2).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                groupCell.setDrawableEnd(getResources().getDrawable(R.mipmap.ic_arrow_xx), 30, 30);
            }
        });
        Switch bold = (Switch) findViewById(R.id.bold_switch);
        bold.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                groupCell.setTextBold(isChecked);
            }
        });
        Switch s = (Switch) findViewById(R.id.resize_switch);
        s.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                groupCell.setShowDividers(isChecked ? GroupCell.SHOW_DIVIDER_TOP | GroupCell.SHOW_DIVIDER_BOTTOM : GroupCell.SHOW_DIVIDER_NONE);
                groupCell.setDividerDrawable(isChecked ? getResources().getDrawable(R.drawable.list_divider) : null);
            }
        });
        findViewById(R.id.text).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                groupCell.setText("手动设置文字");
                groupCell.setTextColor(Color.YELLOW);
                groupCell.setTextSize(17);
            }
        });
        findViewById(R.id.text_end).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                groupCell.setTextEnd("设置尾部文字");
                groupCell.setTextColorEnd(Color.GREEN);
                groupCell.setTextSizeEnd(14);
            }
        });

    }

}
